<template>
    <div class="detail-wrap">
        <Header></Header>
        <div class="page-wrap">
            <div class="page-wrap-inner">
                <div class="path">
                    <Breadcrumb>
                        <BreadcrumbItem>首页</BreadcrumbItem>
                        <BreadcrumbItem>{{groupTitle}}</BreadcrumbItem>
                    </Breadcrumb>
                </div>

                <div class="article">
                    <Divider style="margin:0"></Divider>
                    <div class="title">{{title}}</div>
                    <div class="time-author-dept">
                        发布时间：{{createTime}}&nbsp;&nbsp;&nbsp;&nbsp;来源：[{{dept}}]&nbsp;&nbsp;&nbsp;&nbsp;作者：{{author}}
                    </div>
                    <div class="content">
                        <div class="incidentalFile">
                            附件：<a v-for="item in attr" :href="item.url" target="_blank">&nbsp;{{item.title}}</a>
                        </div>
                        <Divider style="margin-left: 0;margin-top: 5px"></Divider>
                        <div class="content" v-html="content"></div>
                    </div>
                    <Divider style="margin: 0"></Divider>
                    <div class="mark">
                        &nbsp;&nbsp;{{mark}}
                    </div>
                </div>

            </div>
        </div>
        <Footer></Footer>
    </div>
</template>

<script>
    import Header from '../components/header';
    import Footer from '../components/footer';

    export default {
        name: "detail",
        components: {
            Header,
            Footer
        },
        mounted() {
            this.groupTitle = this.getQueryVariable("groupTitle");
            let id = this.getQueryVariable("id");
            let _this = this;
            this.$http({
                method: 'get',
                url: '/hm/api?m=getPublishInfoById&id=' + id
            }).then(function (res) {
                _this.title = res.data.title;
                _this.createTime = res.data.createTime;
                _this.dept = res.data.dept;
                _this.author = res.data.author;
                _this.content = res.data.content;
                _this.attr = res.data.attrInfos;
            }).catch(function (err) {
                console.log(err);
            })
        },
        methods: {
            getQueryVariable(name) {
                const after = window.location.hash.split('?', 2)[1]
                if (after) {
                    const reg = new RegExp('(^|&)' + name + '=([^&]*)(&|$)')
                    const r = after.match(reg)
                    if (r != null) {
                        return decodeURIComponent(r[2])
                    } else {
                        return false
                    }
                }
            }
        },
        data() {
            return {
                groupTitle: "",
                title: "2021年XXXXXXXX考试安排有关事项的通知",
                createTime: "2021-08-21",
                dept: "回民区公安分局",
                author: "马某人",
                content: "<div id=\"contentTxt\" class=\"contentTxt\">\n" +
                    "\t\t\t\t\t\t\t\t<p style=\"text-align: center; font-size: 18px;\"><img src=\"https://www.ruankao.org.cn/asset/upload/image/20200616/15922724674143.png\" title=\"\" alt=\"\" style=\"font-size: 18px;\"><br style=\"font-size: 18px;\"></p><p style=\"text-align: center; font-size: 18px;\"><img src=\"https://www.ruankao.org.cn/asset/upload/image/20200616/15922726217311.png\" title=\"\" alt=\"\" style=\"font-size: 18px;\"><br style=\"font-size: 18px;\"></p><p style=\"text-align: center; font-size: 18px;\"><img src=\"https://www.ruankao.org.cn/asset/upload/image/20200616/15922726295490.jpg\" title=\"\" alt=\"\" style=\"font-size: 18px;\"><br style=\"font-size: 18px;\"></p><p style=\"text-align: center; font-size: 18px;\"><img src=\"https://www.ruankao.org.cn/asset/upload/image/20200616/15922726535410.jpg\" title=\"\" alt=\"\" style=\"font-size: 18px;\"><br style=\"font-size: 18px;\"></p>\t\t\t\t\t\t\t</div>",
                attr: [
                    {
                        title: "附件1",
                        url: "http://wwww.baidu.com"
                    },
                    {
                        title: "附件1",
                        url: "http://wwww.baidu.com"
                    },
                    {
                        title: "附件1",
                        url: "http://wwww.baidu.com"
                    }
                ],
                mark: "声明：本网站所刊载的所有信息，包括文字、图片、软件、声音、相片、录相、图表，广告、商业信息及电子邮件的全部内容，除特别标明之外，版权归呼和浩特市回民分局所有。未经本网的明确书面许可，任何单位或个人不得以任何方式作全部或局部复制、转载、引用，再造或创造与该内容有关的任何派生产品，否则本网将追究其法律责任。"
            }
        }
    }
</script>

<style scoped>
    .detail-wrap {
        min-width: 1200px;
    }

    .page-wrap {
        width: 100%;
        display: flex;
        flex-direction: column;
        align-items: center;
        margin: 5px 0;
    }

    .page-wrap-inner {
        width: 80%;
        min-height: 600px;
    }

    .path {
        font-size: 32px;
        font-weight: bold;
        padding: 10px 15px;
        background-color: #fff;
    }

    .article {
        min-height: 200px;
        background-color: #fff;
        display: flex;
        align-items: center;
        flex-direction: column;
    }

    .article .title {
        padding: 20px 0;
        color: #ff0033;
        text-align: center;
        font-size: 30px;
        font-weight: bold;
    }

    .article .time-author-dept {
        font-size: 16px;
        text-align: center;
        margin-bottom: 20px;
    }

    .article .content {
        margin-left: 30px;
        width: 90%;
        min-height: 500px;
    }

    .article .mark {
        width: 85%;
        padding: 10px;
    }

    .content {
        text-align: justify;
        /*font-size: 18px;*/
    }
    .incidentalFile{
        text-align: right;
    }
</style>